import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const app ={
	state:{
		isShow:true,
		"userProfile":localStorage.loupanUserProfile != null ? JSON.parse(localStorage.loupanUserProfile) : null,
		// "space": localStorage.space != null ? JSON.parse(localStorage.space):null,
	},
	mutations:{
		IS_SHOW_ALERT(state, data) {
        	state.isShow = data;
    	},
    	USER_PROFILE(state, loupanUserProfile) {
			state.userProfile = loupanUserProfile;
			localStorage.loupanUserProfile = JSON.stringify(loupanUserProfile);
		},
		// SPACE(state, space){
		// 	state.space = space;
		// 	localStorage.space=JSON.parse(space);
		// }
	},
	getters:{
		"userProfile":state=>{
			return state.userProfile
		},
		// "SPACE":state=>{
		// 	return state.space
		// }
	},
}
const store = new Vuex.Store({
	strict: process.env.NODE_ENV !== 'production', // 严格模式
	modules: {
		"app":app
	}
})

export default store